//
//  Statement.m
//  takeout
//
//  Created by Mac on 12-6-24.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "Statement.h"

@implementation Statement
- (void)viewDidLoad
{
    //手势
    UISwipeGestureRecognizer *recognizer; 
    recognizer = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(handleSwipeFrom:)];
    [recognizer setDirection:(UISwipeGestureRecognizerDirectionRight)];
    [[self view] addGestureRecognizer:recognizer];
       
    self.title=@"免责声明";
    //定义导航栏左侧按钮
    UIButton *leftButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 54, 27)];
    NSString *filePath=[[NSBundle mainBundle] pathForResource:@"navLeftBtn" ofType:@"png"];
    [leftButton setBackgroundImage:[UIImage imageWithContentsOfFile:filePath] forState:UIControlStateNormal];
    [leftButton setBackgroundImage:[UIImage imageWithContentsOfFile:filePath] forState:UIControlStateHighlighted];
    [leftButton setTitle:@"返 回" forState:UIControlStateNormal]; 
    leftButton.titleLabel.font=[UIFont fontWithName:@"Helvetica-Bold" size:14]; 
    [leftButton addTarget:self action:@selector(backButtonPressd:) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithCustomView:leftButton];
    self.navigationItem.leftBarButtonItem = leftItem;
    
    UITextView *tmpTextView = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
    tmpTextView.text=@"免责声明：\n点送所提供的各项服务的所有权和运作权归点送公司所有。在您使用点送前，请您务必仔细阅读并透彻理解本声明。用户使用本网站提供各项服务的行为，将被视为用户对本声明全部内容的认可。\n1.本软件所载的内容资料均由第三者，四者或机构所提供，仅供参考之用。用户应自行判断内容之真实性。\n2.本软件将尽力确保该等资料的准确，若发现本软件所载列的内容出现问题，请联系我们。本软件具有自行处理所有内容的权力，且将不另行通知。\n3.由于近来通货膨胀急剧，部分价格经常有所调整，用户请自行查询最新价格。以商家价格为准。\n4.本软件不会负责因资料错误而导致的任何损失。\n5.本软件部做任何形式的保证:不保证您手机数据不丢失，不保证原手机功能正常使用或不被改变，不保证自行安装第三方软件的安全性、正确性、合法性。因前述不可抗力或第三方软件等任何原因而导致您不能正常使用点送，本软件不承担任何法律责任。";
    tmpTextView.editable = NO;
    [self.view addSubview:tmpTextView];
}

-(void)handleSwipeFrom:(UISwipeGestureRecognizer *)recognizer{
    if(recognizer.direction==UISwipeGestureRecognizerDirectionRight) {
            [self.navigationController popViewControllerAnimated:YES];
        //执行程序
    }
}

- (void)backButtonPressd:(id)sender{
    NSURL *system_sound_url=[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"1248" ofType:@"wav"]];
    SystemSoundID system_sound_id;
    AudioServicesCreateSystemSoundID((__bridge CFURLRef)system_sound_url, &system_sound_id);
    AudioServicesPlaySystemSound(system_sound_id);
    
    //将当前视图推出栈，程序将进入上一视图
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)viewDidUnload {
    [super viewDidUnload];
}


@end
